/****************************************************************************

Force Engine v0.5

Creado: 28/03/08
Clase: Entity2D.h
Hecho by: German Battiston AKA Melkor

****************************************************************************/

//---------------------------------------------------------------------------
#ifndef ENTITY2D_H
#define ENTITY2D_H
//---------------------------------------------------------------------------
#include "../Defines/Defines.h"
#include "../Graphics/Graphics.h"
//---------------------------------------------------------------------------
class Graphics;
//---------------------------------------------------------------------------
class FORCEENGINE_API Entity2D
{
public:

	Entity2D();
	virtual ~Entity2D();

	float GetPosX() const;
	void SetPosX(float fX);
	float GetPrevPosX() const;

	float GetPosY() const;
	void SetPosY(float fY);
	float GetPrevPosY() const;

	float GetPosZ() const;
	void SetPosZ(float fZ);

	float GetRotationZ() const;
	void SetRotationZ(float rotationZ);

	float GetDimWidth();
	float GetDimHeight();
	void SetDim(float fW, float fH);

	void SetPosXY(float fX, float fY);
	void SetPosXYZ(float fX, float fY, float fZ);

	bool GetMoving();
	void SetMoving(bool bMoving);

	float GetMovingSpeed() const;
	void SetMovingSpeed(float fMovingSpeed);

	float GetMovingAngle() const;
	void SetMovingAngle(float fMovingAngle);

	float GetMovingAngleRad() const;
	void SetMovingAngleRad(float fMovingAngleRad);

	void SetName(std::string kName);
	const std::string& GetName() const;

	virtual void Draw(Graphics &rkGraphics) const;
	virtual void Update(float fTimeBetweenFrames);

	enum CollisionResult
	{
		None,
		Vertical,
		Horizontal
	};

	virtual void OnCollision(Entity2D * pkEntity) = 0;
	CollisionResult CheckCollision(Entity2D* pkEntity) const;

private:

	float m_fW; 
	float m_fH;

	float m_fX;
	float m_fY;
	float m_fZ;

	float m_fRotationZ;

	bool m_bMoving;

	float m_fPrevX;
	float m_fPrevY;
	float m_fMovingSpeed;
	float m_fMovingAngle;
	float m_fMovingAngleRad;
	float m_fGravity;

	std::string m_kName;

	ColorVertex m_akAABBVertices[5];
};
//---------------------------------------------------------------------------
#include "Entity2D.inl"
//---------------------------------------------------------------------------

#endif /*--- ENTITY_2D ---*/

//---------------------------------------------------------------------------